<?php
/*
    "NuSOAP and WSDL"
    http://www.nonplus.net/geek/000752.php

    Copyright 2003, Stepan Riha, All right reserved.

    You're free to make derivative and commercial use of this code
    without attribution.

    Version 2.0 - Oct 29, 2003
    Fixed problems with unquoted string constants.

*/
require_once ('config/cfg.php');

//apache htaccess - www authentication
if ( ( !isset( $PHP_AUTH_USER )) || (!isset($PHP_AUTH_PW))  
     || ( $PHP_AUTH_USER != $htaccessUser ) || ( $PHP_AUTH_PW != $htaccessPassword ) ) { 
    header( 'WWW-Authenticate: Basic realm="Private"' ); 
    header( 'HTTP/1.0 401 Unauthorized' ); 
    echo "This folder is protected "; 
    exit; 
} 

$NAMESPACE = 'urn:Callware';
$server = new soap_server;

$server->debug_flag=false;
$server->configureWSDL('Callware', $NAMESPACE);
$server->wsdl->schemaTargetNamespace = $NAMESPACE;

// ==== METHOD IMPLEMENTATION ==================================================

//include all files in the function/ folder
if ($handle = opendir('function/')) {
  while (false !== ($file = readdir($handle))) {
    if ($file != "." && $file != ".." and substr($file,-4)==".php" ) {
      include ("function/".$file);
    }
  }
  closedir($handle);
}

// ==== WSDL TYPES DECLARATION =================================================

include ("structs.php");

// ==== WSDL METHODS REGISTRATION ==============================================


$server->register(
    'sendCommand',
    array('cmd'=>'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);  

$server->register(
    'getEntity',
    array('id'=>'xsd:int'),
    array('return'=>'tns:EntityArray'),
    $NAMESPACE);  

$server->register(
    'getExtension',
    array('id'=>'xsd:int'),
    array('return'=>'tns:ExtensionArray'),
    $NAMESPACE);    
    
$server->register(
    'getExtensionByExtension',
    array('exten'=>'xsd:string'),
    array('return'=>'tns:ExtensionArray'),
    $NAMESPACE);    
    
$server->register(
    'putExtension',
    array('extension'=>'tsn:Extension'),
    array('return'=>'xsd:int'),
    $NAMESPACE);   
    
$server->register(
    'delExtension',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE); 
    
$server->register(
    'delExtensionByExtension',
    array('exten'=>'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE); 
    
$server->register(
    'getClient',
    array('id'=>'xsd:int', 'prot'=>'xsd:int'),
    array('return'=>'tns:ClientArray'),
    $NAMESPACE);

$server->register(
    'getClientAccount',
    array('id'=>'xsd:int', 'prot'=>'xsd:int'),
    array('return'=>'tns:ClientArray'),
    $NAMESPACE);      
    
$server->register(
    'putClient',
    array('client'=>'tsn:Client'),
    array('return'=>'xsd:int'),
    $NAMESPACE);
    
$server->register(
    'putClientAccount',
    array('id'=>'xsd:int','tech'=>'xsd:int','language'=>'xsd:string','oldpwd'=>'xsd:string','newpwd'=>'xsd:string','vemail'=>'xsd:string','voldpwd'=>'xsd:string','vnewpwd'=>'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);   

$server->register(
    'delClient',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);
    
$server->register(
    'getOffice',
    array('id'=>'xsd:int'),
    array('return'=>'tns:OfficeArray'),
    $NAMESPACE);

$server->register(
    'putOffice',
    array('dep'=>'tsn:Office'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'delOffice',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'getProvider',
    array('id'=>'xsd:int'),
    array('return'=>'tns:ProviderArray'),
    $NAMESPACE);

$server->register(
    'putProvider',
    array('res'=>'tsn:Provider'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'delProvider',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);
    
$server->register(
    'getPhoneNumber',
    array('id'=>'xsd:int'),
    array('return'=>'tns:PhoneNumberArray'),
    $NAMESPACE);

$server->register(
    'putPhoneNumber',
    array('number'=>'tsn:PhoneNumber'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'delPhoneNumber',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'getMetaGroupFromEntity',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'getMetaGroupFromGroup',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);    
    
$server->register(
    'getGroup',
    array('id'=>'xsd:int', 'type'=>'xsd:int'),
    array('return'=>'tns:GroupArray'),
    $NAMESPACE);
    
$server->register(
    'putGroup',
    array('group'=>'tsn:Group'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'delGroup',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'getRight',
    array('id'=>'xsd:int'),
    array('return'=>'tns:RightArray'),
    $NAMESPACE);
    
$server->register(
    'putRight',
    array('right'=>'tsn:Right'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'delRight',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'getApplication',
    array('id'=>'xsd:int'),
    array('return'=>'tns:ApplicationArray'),
    $NAMESPACE);
    
$server->register(
    'getApplicationByName',
    array('name'=>'xsd:string'),
    array('return'=>'tns:ApplicationArray'),
    $NAMESPACE);

$server->register(
    'putApplication',
    array('app'=>'tns:Application'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'delApplication',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'getQueue',
    array('id'=>'xsd:int'),
    array('return'=>'tns:QueueArray'),
    $NAMESPACE);

 $server->register(
    'getQueueByName',
    array('name'=>'xsd:string'),
    array('return'=>'tns:QueueArray'),
    $NAMESPACE);
   
$server->register(
    'putQueue',
    array('queue'=>'tsn:Queue'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'delQueue',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'getIvrNode',
    array('id'=>'xsd:int', 'ivr'=>'xsd:int'),
    array('return'=>'tns:IvrNodeArray'),
    $NAMESPACE);
    
$server->register(
    'putIvrNode',
    array('queue'=>'tsn:IvrNode'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'delIvrNode',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'getIvr',
    array('id'=>'xsd:int'),
    array('return'=>'tns:IvrArray'),
    $NAMESPACE);

$server->register(
    'putIvr',
    array('ivr'=>'tsn:Ivr'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'delIvr',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);
    
$server->register(
    'compileIvr',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'getCard',
    array('id'=>'xsd:int'),
    array('return'=>'tns:CardArray'),
    $NAMESPACE);
    
$server->register(
    'putCard',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'delCard',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);
    

$server->register(
    'getIsdnPort',
    array('id'=>'xsd:int'),
    array('return'=>'tns:PortArray'),
    $NAMESPACE);

$server->register(
    'updateIsdnPort',
    array('ports'=>'tns:PortArray'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'getConfOption',
    array('id'=>'xsd:int','category'=>'xsd:string'),
    array('return'=>'tns:OptionArray'),
    $NAMESPACE);
    
$server->register(
    'getOptionByName',
    array('id'=>'xsd:string','category'=>'xsd:string'),
    array('return'=>'tns:OptionArray'),
    $NAMESPACE);
    
$server->register(
    'putOption',
    array('technology'=>'xsd:int','option'=>'tns:AssociativeArray'),
    array('return'=>'xsd:int'),
    $NAMESPACE);
    
$server->register(
    'getIsdnGroup',
    array('id'=>'xsd:int'),
    array('return'=>'tns:IsdnGroupArray'),
    $NAMESPACE);

$server->register(
    'putIsdnGroup',
    array('group'=>'tns:IsdnGroup'),
    array('return'=>'xsd:int'),
    $NAMESPACE);
    
$server->register(
    'delIsdnGroup',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'getAction',
    array('id'=>'xsd:int'),
    array('return'=>'tns:ActionArray'),
    $NAMESPACE);

$server->register(
    'writeMIsdn',
    array(),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'writeSIP',
    array(),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'writeIAX',
    array(),
    array('return'=>'xsd:int'),
    $NAMESPACE);
    
$server->register(
    'updateNetwork',
    array('option'=>'tns:stringArray'),
    array('return'=>'xsd:int'),
    $NAMESPACE);
    
$server->register(
    'getDirectory',
    array(),
    array('return'=>'tns:DirectoryArray'),
    $NAMESPACE);
    
$server->register(
    'initialize',
    array('genKeys' => 'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);
    
$server->register(
    'getUser',
    array('id'=>'xsd:int'),
    array('return'=>'tns:UserArray'),
    $NAMESPACE);

$server->register(
    'putUser',
    array('user'=>'tns:User'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'checkUser',
    array('username'=>'xsd:string','password'=>'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'delUser',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'createAstConfig',
    array('lines'=>'tns:stringArray','filename'=>'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'viewAstConfigFilename',
    array(),
    array('return'=>'tns:stringArray'),
    $NAMESPACE);

$server->register(
    'viewAstConfig',
    array('filename'=>'xsd:string'),
    array('return'=>'xsd:string'),
    $NAMESPACE);

$server->register(
    'getPublicKey',
    array(),
    array('return'=>'xsd:string'),
    $NAMESPACE);

$server->register(
    'getVoiceMail',
    array('id'=>'xsd:int'),
    array('return'=>'tns:VoiceMailArray'),
    $NAMESPACE);

$server->register(
    'putVoiceMail',
    array('voicemail'=>'tns:VoiceMail'),
    array('return'=>'xsd:int'),
    $NAMESPACE);
    
$server->register(
    'stats',
    array('request'=>'tns:CdrRequest'),
    array('return'=>'tns:CdrArray'),
    $NAMESPACE); 
    
$server->register(
    'getTechnology',
    array('id'=>'xsd:int'),
    array('return'=>'tns:TechnologyArray'),
    $NAMESPACE);

$server->register(
    'getTimeSegment',
    array('id'=>'xsd:int'),
    array('return'=>'tns:TimeSegmentArray'),
    $NAMESPACE);

$server->register(
    'putTimeSegment',
    array('ts'=>'tns:TimeSegment'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'delTimeSegment',
    array('id'=>'xds:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);
    
$server->register(
    'getRule',
    array('id'=>'xds:int','type'=>'xds:int',),
    array('return'=>'tns:RuleArray'),
    $NAMESPACE);

$server->register(
    'putRule',
    array('id'=>'tns:Rule'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'delRule',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'getOutgoingRule',
    array('id'=>'xds:int'),
    array('return'=>'tns:OutgoingRuleArray'),
    $NAMESPACE);

$server->register(
    'putOutgoingRule',
    array('id'=>'tns:OutgoingRule'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'delOutgoingRule',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'getIncomingRule',
    array('id'=>'xds:int'),
    array('return'=>'tns:IncomingRuleArray'),
    $NAMESPACE);

$server->register(
    'putIncomingRule',
    array('id'=>'tns:IncomingRule'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'delIncomingRule',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'moveRule',
    array('id'=>'xsd:int', 'direction'=>'xsd:int', 'type'=>'xsd:int', 'top'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);
    

$server->register(
    'getEntityName',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:string'),
    $NAMESPACE);

$server->register(
    'getMacro',
    array('id'=>'xsd:int'),
    array('return'=>'tns:MacroArray'),
    $NAMESPACE);
    
$server->register(
    'getMacroByName',
    array('name'=>'xsd:string'),
    array('return'=>'tns:MacroArray'),
    $NAMESPACE);

$server->register(
    'putMacro',
    array('id'=>'tns:Macro'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'delMacro',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'resolveMacroParam',
    array('macroId'=>'xsd:int','parameters'=>'xsd:string'),
    array('return'=>'xsd:string'),
    $NAMESPACE);
    
$server->register(
    'getPlugin',
    array('id'=>'xsd:int'),
    array('return'=>'tns:PluginArray'),
    $NAMESPACE);

 $server->register(
    'getPluginByName',
    array('name'=>'xsd:string'),
    array('return'=>'tns:PluginArray'),
    $NAMESPACE);
    
$server->register(
    'getPluginByPackageName',
    array('packageName'=>'xsd:string'),
    array('return'=>'tns:PluginArray'),
    $NAMESPACE);
    
$server->register(
    'getPluginByEntity',
    array('type'=>'xsd:string', 'id'=>'xsd:int'),
    array('return'=>'tns:PluginArray'),
    $NAMESPACE);

$server->register(
    'getPluginEntities',
    array('id'=>'xsd:int'),
    array('return'=>'tns:PluginEntityArray'),
    $NAMESPACE);
    
$server->register(
    'putPlugin',
    array('xmlinfo'=>'xsd:string','xmldata'=>'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);
    
$server->register(
    'delPlugin',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'getTrunk',
    array('id'=>'xsd:int','technology'=>'xsd:int'),
    array('return'=>'tns:ChannelArray'),
    $NAMESPACE);

$server->register(
    'getChannel',
    array('id'=>'xsd:int','technology'=>'xsd:int'),
    array('return'=>'tns:ChannelArray'),
    $NAMESPACE);

$server->register(
    'putChannel',
    array('Channel'=>'tns:Channel'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'delChannel',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'moveTrunk',
    array('id'=>'xsd:int','direction'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'versionCheck',
    array(),
    array('return'=>'tns:AssociativeArray'),
    $NAMESPACE);

$server->register(
    'recordAudioFile',
    array('filename' => 'xsd:string','client' => 'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'getAudioFile',
    array(),
    array('return'=>'tns:AudioFileArray'),
    $NAMESPACE);

$server->register(
    'putAudioFile',
    array('filename' => 'xsd:string','name' => 'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);
    
$server->register(
    'deleteAudioFile',
    array('filename' => 'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);
	
$server->register(
    'renameAudioFile',
    array('filename' => 'xsd:string','newfilename' => 'xsd:string','newname' => 'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'shutdown',
    array('action' => 'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'pbxSwitch',
    array('action' => 'xsd:string'),
    array('return'=>'xsd:string'),
    $NAMESPACE);    
    
$server->register(
    'getVoiceMailList',
    array('exten'=>'xsd:int'),
    array('return'=>'tns:VoiceMailStructureArray'),
    $NAMESPACE);

$server->register(
    'checkVoiceMailMessage',
    array('exten'=>'xsd:string','filename' => 'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);     
    
$server->register(
    'changeVoiceMailMessageGroup',
    array('exten'=>'xsd:string','tofilename' => 'xsd:string','togroup' => 'xsd:string',
          'filename' => 'xsd:string','group' => 'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);      
    
$server->register(
    'deleteVoicemailMessage',
    array('exten'=>'xsd:string','filename' => 'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);   
    
$server->register(
    'getFileFromSandbox',
    array('path' => 'xsd:string'),
    array('return'=>'xsd:base64Binary'),
    $NAMESPACE); 
    
$server->register(
    'recordVoiceMailAnswer',
    array('exten'=>'xsd:string','clientId'=>'xsd:string','filename' => 'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);        
    
$server->register(
    'getVoiceMailAnswers',
    array('exten'=>'xsd:string'),
    array('return'=>'tns:AnswerMessageStructureArray'),
    $NAMESPACE); 

$server->register(
    'deleteVoiceMailAnswer',
    array('exten'=>'xsd:string','filename' => 'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE); 
    
$server->register(
    'setVoiceMailAnswer',
    array('exten'=>'xsd:string','filename' => 'xsd:string','type' => 'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);      
    
$server->register(
    'getMohClass',
    array('classname'=>'xsd:string'),
    array('return'=>'tns:MohClassStructureArray'),
    $NAMESPACE); 

$server->register(
    'createMohClass',
    array('definition'=>'tns:MohClassDefinition'),
    array('return'=>'xsd:int'),
    $NAMESPACE); 

$server->register(
    'modifyMohClass',
    array('definition'=>'tns:MohClassDefinition'),
    array('return'=>'xsd:int'),
    $NAMESPACE); 
   
$server->register(
    'delMohClass',
    array('classname'=>'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE); 
    
$server->register(
    'getMohSongs',
    array('classname'=>'xsd:string'),
    array('return'=>'tns:stringArray'),
    $NAMESPACE); 
    
$server->register(
    'uploadMohSongs',
    array('file_name'=>'xsd:string','file_content'=>'xsd:base64Binary'),
    array('return'=>'xsd:int'),
    $NAMESPACE);
 
$server->register(
    'deleteMohSong',
    array('file_name'=>'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE); 
    
$server->register(
    'soundsInit',
    array('reload'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);      
    
$server->register(
    'getSoundDesc',
    array('filename'=>'xsd:string','cat_id'=>'xsd:int','language'=>'xsd:string'),
    array('return'=>'tns:soundsFileArray'),
    $NAMESPACE);   
    
$server->register(
    'getCatidByTagname',
    array('tagname'=>'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);      
    
$server->register(
    'getLanguages',
    array(),
    array('return'=>'tns:stringArray'),
    $NAMESPACE);   

$server->register(
    'getCategories',
    array(),
    array('return'=>'tns:soundsCategoriesArray'),
    $NAMESPACE);  

$server->register(
    'putTempSound',
    array('filename'=>'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);  
    
$server->register(
    'deleteTempSound',
    array('filename'=>'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);     
     
$server->register(
    'modifySound',
    array('filename'=>'xsd:string','cat_id'=>'xsd:int','language'=>'xsd:string','newcontent'=>'xsd:string','modtext'=>'xsd:int','newtext'=>'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);  

$server->register(
    'createEmptyFile',
    array('filename'=>'xsd:string','cat_id'=>'xsd:int','language'=>'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);   

$server->register(
    'deleteFile',
    array('filename'=>'xsd:string','cat_id'=>'xsd:int','language'=>'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE); 
      
$server->register(
    'mvSoundsFileToSandbox',
    array('cat_id'=>'xsd:int','filename'=>'xsd:string','language'=>'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);    
    
$server->register(
    'recordNewMessage',
    array('clientId'=>'xsd:int','filename'=>'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);  
    
$server->register(
    'deleteRecordedMessage',
    array('filename'=>'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);    

$server->register(
    'uploadMessage',
    array('file_name'=>'xsd:string','file_content'=>'xsd:base64Binary'),
    array('return'=>'xsd:int'),
    $NAMESPACE);
       
$server->register(
    'putInDB',
    array('family'=>'xsd:string','key'=>'xsd:string','value'=>'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);
    
$server->register(
    'rmFromDB',
    array('family'=>'xsd:string','key'=>'xsd:string'),
    array('return'=>'xsd:int'),
    $NAMESPACE);
    
$server->register(
    'getFromDB',
    array('family'=>'xsd:string','key'=>'xsd:string'),
    array('return'=>'xsd:commandReturn'),
    $NAMESPACE);

// ****************************************************************************
// ---- NEW ZAPATA PART STARTS HERE -------------------------------------------
// ****************************************************************************

$server->register(
    'getZapataCard',
    array('id'=>'xsd:int'),
    array('return'=>'tns:ZapCardArray'),
    $NAMESPACE);
    
$server->register(
    'putZapataCard',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'delZapataCard',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'getZapataPortOption',
    array('type' => 'xsd:string'),
    array('return'=>'tns:ZapPortOptionArray'),
    $NAMESPACE);

$server->register(
    'getZapataPort',
    array('id'=>'xsd:int'),
    array('return'=>'tns:ZapPortArray'),
    $NAMESPACE);

$server->register(
    'updateZapataPort',
    array('ports'=>'tns:ZapPortArray','zones' => 'tns:ZapToneArray'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'getZapataChannel',
    array('id'=>'xsd:int'),
    array('return'=>'tns:ZapChannelArray'),
    $NAMESPACE);

$server->register(
    'putZapataChannel',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'delZapataChannel',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'updateZapataChannel',
    array('channel'=>'tns:ZapChannelArray'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'getZapataToneZone',
    array('id'=>'xsd:int'),
    array('return'=>'tns:ZapToneZoneArray'),
    $NAMESPACE);

$server->register(
    'getZapataGroup',
    array('id'=>'xsd:int'),
    array('return'=>'tns:ZapGroupArray'),
    $NAMESPACE);

$server->register(
    'putZapataGroup',
    array('group'=>'tns:ZapGroup'),
    array('return'=>'xsd:int'),
    $NAMESPACE);
    
$server->register(
    'delZapataGroup',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

    
// ****************************************************************************
// ---- NEW ZAPATA PART ENDS HERE ---------------------------------------------
// ****************************************************************************

$server->register(
    'getMeetme',
    array('id'=>'xsd:int'),
    array('return'=>'tns:MeetmeArray'),
    $NAMESPACE);

 $server->register(
    'getMeetmeByName',
    array('name'=>'xsd:string'),
    array('return'=>'tns:MeetmeArray'),
    $NAMESPACE);
   
$server->register(
    'putMeetme',
    array('meetme'=>'tsn:Meetme'),
    array('return'=>'xsd:int'),
    $NAMESPACE);

$server->register(
    'delMeetme',
    array('id'=>'xsd:int'),
    array('return'=>'xsd:int'),
    $NAMESPACE);
    
// ==== PROCESS REQUEST ========================================================

$HTTP_RAW_POST_DATA = isset($GLOBALS['HTTP_RAW_POST_DATA'])
                        ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';
$server->service($HTTP_RAW_POST_DATA);
exit();

?>